<%@include file="/WEB-INF/templates/configuration.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="windows-1252"%>
<!--  **************** Multi Language ******************** -->
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<% 
session = request.getSession(true);
String lang = (String) session.getAttribute("lang");
if(lang==null){
    //default language if language not set.
    lang = "en";
}
%>
<fmt:setLocale value="<%=lang%>" />
<fmt:setBundle basename="<%=lang%>" />
<!--  **************** Multi Language END ******************** -->

<!DOCTYPE html>
<%
    HttpSession session_user = request.getSession(true);
    String firstname = (String) session_user.getAttribute("user_firstname");
    String user_username = (String) session_user.getAttribute("user_username");
    int user_id = 0;
    int user_type = 0;
    if (firstname != null) {
        user_id = Integer.valueOf("" + session_user.getAttribute("user_id"));
        user_type = Integer.valueOf("" + session_user.getAttribute("user_type"));
    }
    String headteacher = (String) request.getAttribute("Headteacher");
%>

<h2 class="course-header left" style=""><fmt:message key="Chapter-title"/>: ${chapter.chapterName}</h2>
<%if (user_type == 3 || user_type == 2) {%>
<a href="${url}chapter/edit?chapterid=${chapter.chapterid}" class="edit icon"></a>
<%}%>
<br class="clearfix">
<hr>
<div class="wrapper-course">
    <div class="right">
        <img class="course-picture" width="150px" height="150px" src="${chapter.chapterpicture}"></img>
    </div>
    <div class="left course-description" style="">
        <p>${chapter.chapterdescription}</p>
    </div>
</div>
<div class="chapter-content">
    <p>${chapter.chapterContent}</p>
</div>
<hr/>

<div class="navigation-course">
    <%if (user_type == 1) {%>
    <c:choose>
        <c:when test="${amounttests != 0}">
            <div class="left" style="margin-right:85px">
                <a href="${url}chapter/test?chapterid=${chapter.chapterid}"><img class="chapterbutton" width="100px" height="100px" src="${imgurl}test-icon.png"></img></a>
                <p><fmt:message key="Test-title"/></p>

            </div>
        </c:when>
    </c:choose>
    <%}else{%>
    <div class="left" style="margin-right:85px">
        <a href="${url}chapter/test?chapterid=${chapter.chapterid}"><img class="chapterbutton" width="100px" height="100px" src="${imgurl}test-icon.png"></img></a>
        <p><fmt:message key="Test-title"/></p>

    </div>
    <%}%>
    <%if (user_type == 1) {%>
    <c:choose>
        <c:when test="${amountasignments != 0}">
            <div class="left" style="margin-right:65px">
                <a href="${url}chapter/uploadassignments?chapterid=${chapter.chapterid}"><img class="chapterbutton" width="100px" height="100px" src="${imgurl}document-icon.png"></img></a>
                <p><fmt:message key="Upload-assignment-title"/></p>

            </div>
        </c:when>
    </c:choose>
    <%}else{%>
    <div class="left" style="margin-right:65px">
        <a href="${url}chapter/uploadassignments?chapterid=${chapter.chapterid}"><img class="chapterbutton" width="100px" height="100px" src="${imgurl}document-icon.png"></img></a>
        <p><fmt:message key="Upload-assignment-title"/></p>
    </div>
    <div class="left">
        <a href="${url}chapter/uploadedassignment/adminview?chapterid=${chapter.chapterid}" class="button" style="width:200px">View uploaded assignments</a>
    </div>
    <%}%>
</div>


